package com.jxmcloud.business.cut.service.impl.database;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jxmcloud.business.cut.mapper.database.IGiftBuyRecordDBMapper;
import com.jxmcloud.business.cut.model.database.DBGiftBuyRecord;
import com.jxmcloud.business.cut.model.query.GiftBuyRecordQuery;
import com.jxmcloud.business.cut.service.database.IGiftBuyRecordDBService;
import com.jxmcloud.business.cut.vo.GiftBuyRecordVo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GiftBuyRecordDBServiceImpl extends ServiceImpl<IGiftBuyRecordDBMapper, DBGiftBuyRecord> implements IGiftBuyRecordDBService {
    @Override
    public boolean insertIntoData(DBGiftBuyRecord info) {
        return this.baseMapper.insert(info) == 1;
    }

    @Override
    public DBGiftBuyRecord selectOne(Integer uid) {
        return this.baseMapper.selectById(uid);
    }

    @Override
    public List<DBGiftBuyRecord> selectAll(List<Integer> uid) {
        QueryWrapper<DBGiftBuyRecord> wrapper = new QueryWrapper<>();
        wrapper.in("uid", uid);
        return this.baseMapper.selectList(wrapper);
    }

    @Override
    public boolean deleteData(Integer uid) {
        QueryWrapper<DBGiftBuyRecord> wrapper = new QueryWrapper<>();
        wrapper.in("uid", uid);
        return this.baseMapper.delete(wrapper) == 1;
    }

    @Override
    public boolean updateData(DBGiftBuyRecord info) {
        return this.baseMapper.updateById(info) == 1;
    }

    @Override
    public IPage<GiftBuyRecordVo> getGiftBuyRecordPage(GiftBuyRecordQuery query) {
        return this.baseMapper.selectGiftBuyRecordPage(query);
    }
}
